using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Emlyn.Website.Users;

public partial class LoggedInStatus : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        bool lloggedin = !String.IsNullOrEmpty(Page.User.Identity.Name);

        pnlLoggedIn.Visible = lloggedin;
        pnlLoggedOut.Visible = !lloggedin;

        if (lloggedin)
        {
            User luser = (new UserQuery()).GetUserByUserName(Page.User.Identity.Name);
            lblUserName.Text = Page.User.Identity.Name;
        }
    }
    protected void lbLogout_Click(object sender, EventArgs e)
    {
        System.Web.Security.FormsAuthentication.SignOut();
        Response.Redirect("default.aspx");
    }
    protected void lbLogin_Click(object sender, EventArgs e)
    {
        System.Web.Security.FormsAuthentication.RedirectToLoginPage();
    }
    protected void lbUpdateUser_Click(object sender, EventArgs e)
    {
        Response.Redirect("UpdateUser.aspx");
    }
}
